<%@page import="com.bosch.in.rtp1.ept.constant.ReleasedHoldParameter"%>
<%@page import="com.bosch.in.rtp1.ept.constant.CommonConstants"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.List" %>
<%@ page import="com.bosch.in.jfree.chart.JfreeChartIntf"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

<link href="css/imageZoom.css" type="text/css" rel="stylesheet"></link>
<script type="text/javascript" src="js/tipmessage.js"></script>
<script type="text/javascript" src="js/imageZoom.js"></script>
<script type="text/javascript" src="js/hldDurByMonth.js"></script>
<form name="searchForm" action="hldDiagramByMonth.do?cmd=hldDiagramByMonth" method="POST">
<div class="ui-jqgrid ui-widget ui-corner-all">
	<div class = "ui-jqgrid-view">
		<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
			<a id="minFilterButton" class="ui-jqgrid-titlebar-close HeaderButton" href="javascript:void(0)" style="right: 0px;">
				<span id="minButton" class="ui-icon ui-icon-circle-triangle-n"></span>
			</a>
				<span class="ui-jqgrid-title">Filter Criteria</span>
		</div>
	</div>
</div>
<table id="filterCriteria" width="100%" border="0" class="box">
	<tbody>
		<tr>
			<td>
				<input id="hiddenYear" 		type="hidden" value="<%=request.getAttribute(ReleasedHoldParameter.DIAGRAM_YEAR_HIDDEN_PARAMETER)%>">
				<input id="hiddenMonth" 	type="hidden" value="<%=request.getAttribute(ReleasedHoldParameter.DIAGRAM_MONTH_HIDDEN_PARAMETER)%>">
			</td>
		</tr>
		<tr>	
			<td width="200px" nowrap="nowrap"> 
				<span style="display:inline-block;font-size: 11px;margin: 5px;">Month</span>
				<span style="display:inline-block;font-size: 11px;margin: 5px;">:</span>
				<html:select  name="hldDurByMonth" property="selectedMonth" styleClass="DropDownTextBox" style="width:120px">
						<html:optionsCollection name="hldDurByMonth" property="months" value="value" label="display"/>
				</html:select>
			</td>	
			<td width="200px" nowrap="nowrap"> 
				<span style="display:inline-block;font-size: 11px;margin: 5px;">Year</span>
				<span style="display:inline-block;font-size: 11px;margin: 5px;">:</span>
				<html:select  name="hldDurByMonth" property="selectedYear" styleClass="DropDownTextBox" style="width:120px">
						<html:optionsCollection name="hldDurByMonth" property="years" value="value" label="value"/>
				</html:select>
			</td>		
			<td width="100px"> 
				<a class="bosch_button_style" href="javascript:loadHldDurByMonthGraph();">Show</a>
			</td>
			<td> 
			</td>
			
		</tr>
	</tbody>
</table>
</form>
<br/>
<table width="100%" border="0" class="box">
	<tbody>
		<tr>
			<td width="4%">				
			</td>
			<td width="30%" align="center" nowrap="nowrap"> 
				<span style="font-size: 11px;"> Priority 1 </span>
			</td>
			<td width="30%" align="center" nowrap="nowrap"> 
				<span style="font-size: 11px;"> Priority 2 </span>
			</td>
			<td width="30%" align="center" nowrap="nowrap"> 
				<span style="font-size: 11px;"> Priority 3 </span>
			</td>
		</tr>	
		<%
				List<String> fileNames = (List<String>) request.getAttribute(ReleasedHoldParameter.HLD_DUR_BY_MONTH_DIAGRAM);
				for (int i=0; i<fileNames.size(); i=i+ReleasedHoldParameter.NUM_OF_CHART_PER_ROW)
				{
		%>
					<tr>
						<td width="10%" nowrap="nowrap"> 
							<% 
								int month = (Integer) request.getAttribute(ReleasedHoldParameter.DIAGRAM_MONTH_HIDDEN_PARAMETER);
								if ( month == 0) 
								{
							%>
								<span style="font-size: 11px;"><%=CommonConstants.MONTH_LIST[(i/3)+1]%></span>
							<%
								}
								else
								{
							%>
								<span style="font-size: 11px;"><%=CommonConstants.MONTH_LIST[month]%></span>
							<%
								}
							%>	
						</td>
						<%
							for (int j=0; j<ReleasedHoldParameter.NUM_OF_CHART_PER_ROW&&(i+j)<fileNames.size();++j)
							{
								String fileName = fileNames.get(i+j);
								String imgMapFile = fileName + JfreeChartIntf.IMAGEMAP_SUFFIX;
								out.write((String)request.getAttribute(imgMapFile));
								int priority = j+1;
								int monthString = month == 0 ? (i/3)+1 : month;
						%>
								<td id="images" width="30%" align="center" > 
										<img id="<%=priority%>P<%=monthString%>" src="servlet/DisplayChart?filename=<%=fileName%>&timestamp=<%=Calendar.getInstance().getTimeInMillis()%>"
											usemap="#<%=fileName%>" border="0" align="middle">
								</td>
						<%
							}
						%>
					</tr>	
		<%
				} 
		%>
	</tbody>
</table>
<script type="text/javascript">
zoomInAllMap();
</script>
<br>
<div
	id="toolTipForChart"
	style="display:none;
	position:absolute;
	border-style: solid;
	border: '1px';
	background-color: white;
	z-index:1003;
	padding: 5px;">
</div>
